package model;

import base.BaseModel;
import base.BaseObserver;
import base.ResultCallBack;
import bean.KechengBannerBean;
import bean.ResultBean;
import jiyun.com.yiyanmeng.http.HttpManager;
import jiyun.com.yiyanmeng.http.MySerivce;
import presenter.KeChengPresenter;
import utils.RxUtil;

/**
 * Created by Windows on 2019/11/5.
 */

public class KeChengModel extends BaseModel {
    public void getData(final ResultCallBack<KechengBannerBean> callBack) {
        MySerivce serivce = HttpManager.getInstance().getSerivce();
        serivce.kechengbanner()
                .compose(RxUtil.<ResultBean<KechengBannerBean>>changeThread())
                .compose(RxUtil.<KechengBannerBean>changeResult())
                .subscribe(new BaseObserver<KechengBannerBean>() {
                    @Override
                    public void onSuccess(KechengBannerBean kechengBannerBean) {
                        //Log.e("liangxq", "onSuccess: "+kechengBannerBean.getLunbo().toString() );
                        callBack.onSuccess(kechengBannerBean);
                    }

                    @Override
                    public void onFail(String error) {
                        callBack.onFail(error);
                    }
                });


    }
}
